import Vue from 'vue'
import Axios from 'axios'

import Cookies from 'js-cookie'

import 'normalize.css/normalize.css' // css重置样式
import Element from 'element-ui'
import './styles/element-variables.scss'
// import enLang from 'element-ui/lib/locale/lang/en'// 如果使用中文语言包请默认支持，无需额外引入，请删除该依赖

import '@/styles/index.scss' // 全局样式
import '@/styles/common.scss' // 全局样式
import '@/iconfont/iconfont.css' // 字体样式

import App from './App'
import store from './store'
import router from './router'

import './icons' // icon
import './permission' // permission control
import './utils/error-log' // error log

import * as filters from './filters' // global filters

// 全局组件

// 全局组件
import ExtendCard from '@/components/ExtendCard'
import TableLayout from '@/components/TableLayout'
import ExTable from '@/components/ExTable'
import ExDialog from '@/components/ExDialog'
import CommonSelect from '@/components/CommonSelect/index'
import { TextList, TextItem } from '@/components/TextList'
import { GridLayout, GridItem } from '@/components/GridLayout'
import ExImage from '@/components/ExImage/index.vue'
import VueClipboard from 'vue-clipboard2'
Vue.use(VueClipboard)

Vue.component('ex-card', ExtendCard)
Vue.component('table-layout', TableLayout)
Vue.component('ex-table', ExTable)
Vue.component('ex-dialog', ExDialog)
Vue.component('common-select', CommonSelect)
Vue.component('ex-image', ExImage)

Vue.use(TextList)
Vue.use(TextItem)
Vue.use(GridLayout)
Vue.use(GridItem)


Vue.use(Element, {
  size: Cookies.get('size') || 'medium' // set element-ui default size
  // locale: enLang // 如果使用中文，无需设置，请删除
})

// 全局方法
import { getStatusList, getStatusText } from '@/utils/common'
Vue.prototype.$getStatusList = getStatusList // 获取各种状态下以及类型下的列表
Vue.prototype.$getStatusText = getStatusText // 状态或者类型的文本值
Vue.prototype.$ajax = Axios

//查询字典
import { getSelectList } from '@/api/common'
Vue.prototype.$getSelectList = getSelectList // 状态或者类型的文本值

// 全局变量
Vue.prototype.$IMG_URL = process.env.VUE_APP_IMG_URL


// register global utility filters
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
